package cn.com.duiba.millionaire.center;

import cn.com.duiba.wolf.utils.ClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableDuibaFeignClients;
import org.springframework.context.annotation.ImportResource;

/**
 * ClassName: Application <br/>
 * date: 2016年11月30日 下午5:05:37 <br/>
 *
 * @since JDK 1.6
 */
@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceTransactionManagerAutoConfiguration.class, DataSourceAutoConfiguration.class})
@ImportResource({"classpath:/spring/spring-config.xml"})
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableDuibaFeignClients(basePackages = "cn.com.duiba")
public class Application {
    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    /**
     * main:(这里用一句话描述这个方法的作用). <br/>
     *
     * @param args
     * @since JDK 1.6
     */
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        ClassUtils.checkSerializable("cn.com.duiba.millionaire.center.api.dto");
        SpringApplication sa = new SpringApplication(Application.class);
        sa.run(args);
        long period = System.currentTimeMillis() - start;
        logger.warn("Application start successfully in {}s.", period / 1000.0);
    }
}
